﻿@{
    ViewBag.Title = "ViewPage1";
    Layout = "~/Views/Shared/BaseView.cshtml";
}
@{
    Common.Web.Cookie cookie = new Common.Web.Cookie();
    int visiterId = Convert.ToInt32(cookie.GetCookie("LoginUserId"));
    BenefitHelper.DB.DBManager db = new BenefitHelper.DB.DBManager();
    if (BenefitHelper.Sys.VisitPrower.HasAdminPrower(visiterId, db))
    { 
    <div id="buttons">
        <span>
            <p>
                <a href="/Init" target="_blank" title="后台管理">后台管理</a>
            </p>
        </span>
    </div>
    }
    db.Dispose();
}
<dl id="xiangmu">
    <dt><span id="title2">@ViewBag.company.CompanyName</span></dt>
    <dd>
        <table width="100%" border="0" cellspacing="0" cellpadding="0" id="panzhongfenxi">
            <tr>
                <td style="border-left: 1px solid #ecc7b5;">
                    <a href="/Company/Index/1/@ViewBag.datequery">
                        <img src="/Content/images/icon_01.gif" />小组盈利 </a>
                </td>
                <td class="selected">
                    <img src="/Content/images/icon_09.gif" />公司排名
                </td>
                <td>
                    <a href="/CompanyHistory/Index/1/@ViewBag.pdate">
                        <img src="/Content/images/icon_10.gif" />历史数据</a>
                </td>
                <td>
                    <a href="/CompanyReport/Index/1/@ViewBag.pdate">
                        <img src="/Content/images/icon_05.gif" />报表</a>
                </td>
            </tr>
        </table>
    </dd>
</dl>
<div id="bigDataBox">
    <div class="date-select-bar">
        @for (int i = 1; i <= 12; i++)
        {
            if (!string.IsNullOrEmpty(ViewBag.querymonth.ToString()))
            {


                if (Convert.ToInt32(ViewBag.querymonth) == i)
                { 
            <a href="/CompanySort/Index/1/@ViewBag.queryyear@ViewBag.querymonth" class='cur'>@i</a>
                }
                else
                {
                    if (i < 10)
                    {
                        string z = "0" + i;
            <a href="/CompanySort/Index/1/@ViewBag.queryyear@z">@i</a>
                    }
                    else
                    {
            <a href="/CompanySort/Index/1/@ViewBag.queryyear@i">@i</a>
                    }

                }
            }
            else
            {
                if (i < 10)
                {
                    string z = "0" + i;
            <a href="/CompanySort/Index/1/@ViewBag.queryyear@z">@i</a>
                }
                else
                {
            <a href="/CompanySort/Index/1/@ViewBag.queryyear@i">@i</a>
                }

            }
        }
        @if (string.IsNullOrEmpty(ViewBag.querymonth.ToString()))
        {
            <a href="/CompanySort/Index/1/@ViewBag.queryyear" class='cur'>整年数据</a>
        }
        else
        {
            <a href="/CompanySort/Index/1/@ViewBag.queryyear">整年数据</a>
        }
    </div>
    <div class="date-select-bar" style="text-align: right; float: right;">
        @for (int i = 2011; i <= DateTime.Now.Year; i++)
        {
            if (Convert.ToInt32(ViewBag.queryyear) == i)
            {
            <a href="/CompanySort/Index/1/@i@ViewBag.querymonth" class='cur'>@i</a>
            }
            else
            {
            <a href="/CompanySort/Index/1/@i@ViewBag.querymonth">@i</a>
            }
        }
    </div>
    <br />
    <br />
    <div style="width: 60%; background-repeat: no-repeat; float: left; text-align: left;">
        <img src="/content/images/xiaozupaihang.png" />
    </div>
    @* <div id="DateSelectBar" class="date-select-bar" style="float: right;">
        <a class='cur' id="b1">小组排行</a><a id="b1">个人</a>
    </div>*@
    <table cellspacing="0" cellpadding="0" class="list" style="width: 100%;">
        <tr>
            <td class="title">
                小组
            </td>
            <td class="title">
                净利润
            </td>
            <td class="title">
                交易笔数
            </td>
            <td class="title">
                胜率
            </td>
            <td class="title">
                小组占比
            </td>
            <td class="title">
                累计收益
            </td>
            @*            <td class="title">
                榜首次数
            </td>*@
        </tr>
        @{
            double sum1 = 0;
            double sum2 = 0;
            double sum3 = 0;
            double sum4 = 0;
            double sum5 = 0;
            double allprofit = 0;
            if (string.IsNullOrEmpty(ViewBag.querymonth))
            {
                foreach (BenefitHelper.Data.Year.GroupYearSum sum in ViewBag.list)
                {
                    allprofit += sum.Profit;
                }
                foreach (BenefitHelper.Data.Year.GroupYearSum sum in ViewBag.list)
                {
                    sum1 += sum.Profit;
                    sum2 += sum.BillCount;
                    sum3 += sum.WinRate;
                    sum4 += sum.Profit;
                    sum5 += sum.DayCount;
            <tr>
                <td>
                    @sum.Group.GroupName
                </td>
                <td>
                    @string.Format("{0:N2}", sum.Profit)
                </td>
                <td>
                    @sum.BillCount
                </td>
                <td>
                    @sum.WinRate
                </td>
                <td>
                    @Math.Round(sum.Profit * 100 / allprofit, 2) %
                </td>
                <td class="leftyes">
                    @string.Format("{0:N2}", sum.DayCount)
                </td>
                @*           <td class="leftyes">
                    
                </td>*@
            </tr>
                }
            }
            else
            {
                foreach (BenefitHelper.Data.Month.GroupMonthSum sum in ViewBag.list)
                {
                    allprofit += sum.Profit;
                }
                foreach (BenefitHelper.Data.Month.GroupMonthSum sum in ViewBag.list)
                {
                    sum1 += sum.Profit;
                    sum2 += sum.BillCount;
                    sum3 += sum.WinRate;
                    sum4 += sum.Profit;
                    sum5 += sum.DayCount;
            <tr>
                <td>
                    @sum.Group.GroupName
                </td>
                <td>
                    @string.Format("{0:N2}", sum.Profit)
                </td>
                <td>
                    @sum.BillCount
                </td>
                <td>
                    @sum.WinRate
                </td>
                <td>
                    @Math.Round(sum.Profit * 100 / allprofit, 2) %
                </td>
                <td class="leftyes">
                    @string.Format("{0:N2}", sum.DayCount)
                </td>
                @*              <td class="leftyes">
                    
                </td>*@
            </tr>
                }
            }
            
        }
        <tr>
            <td class="bottomyes">
                合计
            </td>
            <td class="bottomyes">
                @string.Format("{0:N2}", sum1)
            </td>
            <td class="bottomyes">
                @sum2
            </td>
            <td class="bottomyes">
                @sum3
            </td>
            <td class="bottomyes">
                -
            </td>
            <td class="bottomyes leftyes">
                @string.Format("{0:N2}", sum5)
            </td>
            @*            <td class="bottomyes leftyes">
                2342
            </td>*@
        </tr>
    </table>
    <div style="height: 5px; line-height: 5px;">
    </div>
    <div style="height: 5px; line-height: 5px;">
    </div>
    <div style="width: 60%; background-repeat: no-repeat; float: left; text-align: left;">
        <img src="/content/images/jinjigongsipaiming.png" />
    </div>
    <table cellspacing="0" cellpadding="0" class="list" style="width: 100%;">
        <tr>
            <td class="title">
                经纪公司
            </td>
            <td class="title">
                手续费
            </td>
            <td class="title">
                平仓盈亏
            </td>
            <td class="title">
                交易笔数
            </td>
            <td class="title">
                胜率
            </td>
        </tr>
        @{
            double sum11 = 0;
            double sum12 = 0;
            double sum13 = 0;
            double sum14 = 0;
            if (string.IsNullOrEmpty(ViewBag.querymonth))
            {
                foreach (BenefitHelper.Data.Year.BrokerageYearTradeInfo info in ViewBag.brokerageinfos)
                {
                    sum11 += info.Free;
                    sum12 += info.Profit;
                    sum13 += info.BillCount;

                    double divid = info.LoseCount + info.WinCount;
                    if (divid != 0)
                    {
                        sum14 += info.WinCount / (info.LoseCount + info.WinCount);
                    }
            <tr>
                <td>
                    @info.Broker.BrokerName
                </td>
                <td>
                    @string.Format("{0:N2}", info.Free)
                </td>
                <td>
                    @string.Format("{0:N2}", info.Profit)
                </td>
                <td>
                    @info.BillCount
                </td>
                <td class="leftyes">
                    @if (divid != 0)
                    {
                        @(info.WinCount / (info.LoseCount + info.WinCount))
                    }
                    else
                    {
                        <span>0</span>
                    }
                </td>
            </tr>
                }
            }
            else
            {
                foreach (BenefitHelper.Data.Month.BrokerageMonthTradeInfo info in ViewBag.brokerageinfos)
                {
                    sum11 += info.Free;
                    sum12 += info.Profit;
                    sum13 += info.BillCount;

                    double divid = info.LoseCount + info.WinCount;
                    if (divid != 0)
                    {
                        sum14 += info.WinCount / (info.LoseCount + info.WinCount);
                    }
            <tr>
                <td>
                    @info.Broker.BrokerName
                </td>
                <td>
                    @string.Format("{0:N2}", info.Free)
                </td>
                <td>
                    @string.Format("{0:N2}", info.Profit)
                </td>
                <td>
                    @info.BillCount
                </td>
                <td class="leftyes">
                    @if (divid != 0)
                    {
                        @(info.WinCount / (info.LoseCount + info.WinCount))
                    }
                </td>
            </tr>
                }
            }
        }
        <tr>
            <td class="bottomyes">
                合计
            </td>
            <td class="bottomyes">
                @sum11
            </td>
            <td class="bottomyes">
                @sum12
            </td>
            <td class="bottomyes">
                @sum13
            </td>
            <td class="bottomyes leftyes">
                @sum14
            </td>
        </tr>
    </table>
    <div style="height: 5px; line-height: 5px;">
    </div>
    <div class="statisticsTime" style="display: none;">
        净利润排行
        <table cellspacing="0" cellpadding="0" class="list" style="width: 100%;">
            <tr>
                <td>
                    人员
                </td>
                <td>
                    净利润
                </td>
                <td>
                    交易次数
                </td>
                <td>
                    胜率
                </td>
                <td>
                    占小组比率
                </td>
                <td>
                    累计收益
                </td>
                <td>
                    本公司top5次数
                </td>
            </tr>
            <tr>
                <td>
                    朱浩
                </td>
                <td>
                    43
                </td>
                <td>
                    245
                </td>
                <td>
                    234
                </td>
                <td>
                    2342
                </td>
                <td>
                    234
                </td>
                <td>
                    2342
                </td>
            </tr>
            <tr>
                <td>
                    李正元
                </td>
                <td>
                    43
                </td>
                <td>
                    245
                </td>
                <td>
                    234
                </td>
                <td>
                    2342
                </td>
                <td>
                    234
                </td>
                <td>
                    2342
                </td>
            </tr>
            <tr>
                <td>
                    梅祥发
                </td>
                <td>
                    43
                </td>
                <td>
                    245
                </td>
                <td>
                    234
                </td>
                <td>
                    2342
                </td>
                <td>
                    234
                </td>
                <td>
                    2342
                </td>
            </tr>
            <tr>
                <td>
                    合计
                </td>
                <td>
                    43
                </td>
                <td>
                    245
                </td>
                <td>
                    234
                </td>
                <td>
                    2342
                </td>
                <td>
                    234
                </td>
                <td>
                    2342
                </td>
            </tr>
        </table>
        <div style="height: 5px; line-height: 5px;">
        </div>
        手续费排行
        <table cellspacing="0" cellpadding="0" class="list" style="width: 100%;">
            <tr>
                <td>
                    人员
                </td>
                <td>
                    手续费
                </td>
                <td>
                    交易次数
                </td>
                <td>
                    胜率
                </td>
                <td>
                    占小组比率
                </td>
                <td>
                    累计收益
                </td>
                <td>
                    本公司top5次数
                </td>
            </tr>
            <tr>
                <td>
                    朱浩
                </td>
                <td>
                    43
                </td>
                <td>
                    245
                </td>
                <td>
                    234
                </td>
                <td>
                    2342
                </td>
                <td>
                    234
                </td>
                <td>
                    2342
                </td>
            </tr>
            <tr>
                <td>
                    李正元
                </td>
                <td>
                    43
                </td>
                <td>
                    245
                </td>
                <td>
                    234
                </td>
                <td>
                    2342
                </td>
                <td>
                    234
                </td>
                <td>
                    2342
                </td>
            </tr>
            <tr>
                <td>
                    梅祥发
                </td>
                <td>
                    43
                </td>
                <td>
                    245
                </td>
                <td>
                    234
                </td>
                <td>
                    2342
                </td>
                <td>
                    234
                </td>
                <td>
                    2342
                </td>
            </tr>
            <tr>
                <td>
                    合计
                </td>
                <td>
                    43
                </td>
                <td>
                    245
                </td>
                <td>
                    234
                </td>
                <td>
                    2342
                </td>
                <td>
                    234
                </td>
                <td>
                    2342
                </td>
            </tr>
        </table>
        <div style="height: 5px; line-height: 5px;">
        </div>
        胜率排行
        <table cellspacing="0" cellpadding="0" class="list" style="width: 100%;">
            <tr>
                <td>
                    人员
                </td>
                <td>
                    胜率
                </td>
                <td>
                    交易次数
                </td>
                <td>
                    胜率
                </td>
                <td>
                    占小组比率
                </td>
                <td>
                    累计收益
                </td>
                <td>
                    本公司top5次数
                </td>
            </tr>
            <tr>
                <td>
                    朱浩
                </td>
                <td>
                    43
                </td>
                <td>
                    245
                </td>
                <td>
                    234
                </td>
                <td>
                    2342
                </td>
                <td>
                    234
                </td>
                <td>
                    2342
                </td>
            </tr>
            <tr>
                <td>
                    李正元
                </td>
                <td>
                    43
                </td>
                <td>
                    245
                </td>
                <td>
                    234
                </td>
                <td>
                    2342
                </td>
                <td>
                    234
                </td>
                <td>
                    2342
                </td>
            </tr>
            <tr>
                <td>
                    梅祥发
                </td>
                <td>
                    43
                </td>
                <td>
                    245
                </td>
                <td>
                    234
                </td>
                <td>
                    2342
                </td>
                <td>
                    234
                </td>
                <td>
                    2342
                </td>
            </tr>
            <tr>
                <td>
                    合计
                </td>
                <td>
                    43
                </td>
                <td>
                    245
                </td>
                <td>
                    234
                </td>
                <td>
                    2342
                </td>
                <td>
                    234
                </td>
                <td>
                    2342
                </td>
            </tr>
        </table>
        <div style="height: 5px; line-height: 5px;">
        </div>
        占小组比率排行
        <table cellspacing="0" cellpadding="0" class="list" style="width: 100%;">
            <tr>
                <td>
                    人员
                </td>
                <td>
                    占小组比率
                </td>
                <td>
                    交易次数
                </td>
                <td>
                    胜率
                </td>
                <td>
                    占小组比率
                </td>
                <td>
                    累计收益
                </td>
                <td>
                    本公司top5次数
                </td>
            </tr>
            <tr>
                <td>
                    朱浩
                </td>
                <td>
                    43
                </td>
                <td>
                    245
                </td>
                <td>
                    234
                </td>
                <td>
                    2342
                </td>
                <td>
                    234
                </td>
                <td>
                    2342
                </td>
            </tr>
            <tr>
                <td>
                    李正元
                </td>
                <td>
                    43
                </td>
                <td>
                    245
                </td>
                <td>
                    234
                </td>
                <td>
                    2342
                </td>
                <td>
                    234
                </td>
                <td>
                    2342
                </td>
            </tr>
            <tr>
                <td>
                    梅祥发
                </td>
                <td>
                    43
                </td>
                <td>
                    245
                </td>
                <td>
                    234
                </td>
                <td>
                    2342
                </td>
                <td>
                    234
                </td>
                <td>
                    2342
                </td>
            </tr>
            <tr>
                <td>
                    合计
                </td>
                <td>
                    43
                </td>
                <td>
                    245
                </td>
                <td>
                    234
                </td>
                <td>
                    2342
                </td>
                <td>
                    234
                </td>
                <td>
                    2342
                </td>
            </tr>
        </table>
        <div style="height: 5px; line-height: 5px;">
        </div>
        每笔收益排行
        <table cellspacing="0" cellpadding="0" class="list" style="width: 100%;">
            <tr>
                <td>
                    人员
                </td>
                <td>
                    平均每笔收益
                </td>
                <td>
                    交易次数
                </td>
                <td>
                    胜率
                </td>
                <td>
                    占小组比率
                </td>
                <td>
                    累计收益
                </td>
                <td>
                    本公司top5次数
                </td>
            </tr>
            <tr>
                <td>
                    朱浩
                </td>
                <td>
                    43
                </td>
                <td>
                    245
                </td>
                <td>
                    234
                </td>
                <td>
                    2342
                </td>
                <td>
                    234
                </td>
                <td>
                    2342
                </td>
            </tr>
            <tr>
                <td>
                    李正元
                </td>
                <td>
                    43
                </td>
                <td>
                    245
                </td>
                <td>
                    234
                </td>
                <td>
                    2342
                </td>
                <td>
                    234
                </td>
                <td>
                    2342
                </td>
            </tr>
            <tr>
                <td>
                    梅祥发
                </td>
                <td>
                    43
                </td>
                <td>
                    245
                </td>
                <td>
                    234
                </td>
                <td>
                    2342
                </td>
                <td>
                    234
                </td>
                <td>
                    2342
                </td>
            </tr>
            <tr>
                <td>
                    合计
                </td>
                <td>
                    43
                </td>
                <td>
                    245
                </td>
                <td>
                    234
                </td>
                <td>
                    2342
                </td>
                <td>
                    234
                </td>
                <td>
                    2342
                </td>
            </tr>
        </table>
        <div style="height: 5px; line-height: 5px;">
        </div>
    </div>
    <div style="height: 5px; line-height: 5px;">
    </div>
    <div class="report-tip">
        <div class="report-tip-text">
            <div>
                <b>功能说明：</b></div>
            <div>
                亏损性成交：相对于当前（统计时间显示的时间）股票价格，在所有当日已经的成交中对于买入用户处于亏损的成交分布。<br />
                获利性成交：相对于当前（统计时间显示的时间）股票价格，在所有当日已经的成交中对于买入用户处于获利的成交分布。<br />
                成交均价：所有处于亏损或获利的不同成交单子中进行统计，平均成交价格。</div>
        </div>
        <div class="report-tip-close">
            &nbsp;</div>
        <div class="report-tip-text">
            <div>
                <b>使用帮助：</b></div>
            <div>
                本内容主要是将大小单成交与获利与亏损结合起来，以便于用户可以通过分析来获取有利于交易的市场交易习惯和潜在交易机会。</div>
        </div>
        <div class="report-tip-text">
            <div>
                <b>数据更新：</b></div>
            <div>
                盘中数据动态更新，更新间隔5分钟，由于运算因素，实时成交数据整体延时约5-10分钟。</div>
        </div>
    </div>
</div>
<script type="text/javascript">
    function show(obj) {
        $(".statisticsTime").toggle();
        var id = obj.id
        if (id == "b1") {
            $("#b2").removeClass();
            $("#b1").addClass("cur");
        } else {
            $("#b1").removeClass();
            $("#b2").addClass("cur");
        }
    }
</script>
